package com.xtx.air.jcaptcha;

import com.octo.captcha.image.ImageCaptcha;

import java.awt.image.BufferedImage;
import java.io.Serializable;

/**
 * User: hanyi
 * Date: 12-2-20
 * Time: 下午9:26
 */
public class GimpyIgnoreCase extends ImageCaptcha implements Serializable {
    private String response;

    protected GimpyIgnoreCase(String question, BufferedImage challenge, String response) {
        super(question, challenge);
        this.response = response;
    }

    private final Boolean validateResponse(String response) {
        return Boolean.valueOf(response.equalsIgnoreCase(this.response));
    }

    @Override
    public Boolean validateResponse(Object o) {
        return ((null != response) && (response instanceof String)) ? validateResponse((String)response) : Boolean.FALSE;
    }

    public String getResponse() {
        return response;
    }
}
